package day04;
import java.util.Scanner;
public class Day04Test {
    public static void main(String[] args) {

        Scanner scan = new Scanner(System.in);
        System.out.println("请输出数字：");
        int num = scan.nextInt();
        switch (num){
            case 1:
                System.out.println("存款");
                break;
            case 2:
                System.out.println("取款");
                break;
            case 3:
                System.out.println("转账");
                break;
            case 4:
                System.out.println("退出");
            default:
                System.out.println("输入错误");
        }

        /*Guessing猜数字之while版：
        Scanner scan = new Scanner(System.in);
        int num = (int)(Math.random()*1000+1);
        //System.out.println(num);
        System.out.println("猜数字：");
        int guess = scan.nextInt();
        while(guess!=num){
            if(guess>num){
                System.out.println("猜大了");
            }else {
                System.out.println("猜小了");
            }
            guess =scan.nextInt();
        }
        System.out.println("猜对了！");

         */
        /*Guseeing猜数字之do...while版：
        Scanner scan = new Scanner(System.in);
        int num = (int)(Math.random()*1000+1);
        int guess;
        do {
            System.out.println("请猜数字：");
             guess = scan.nextInt();
             if(guess>num){
                 System.out.println("猜大了");
             } else if(guess<num){
                 System.out.println("猜小了");
             } else {
                 System.out.println("猜对了！");
             }
        }while(guess!=num);

         */
        /*for循环
        for(int num = 0;num<5;num++){
            System.out.println("行动是成功的阶梯");
        }
        for(int num = 1;num <=9;num++){
            System.out.println(num+"*9="+num*9);
        }
        for (int num = 1;num<=9;num+=2){
            System.out.println(num+"*9="+num*9);
        }
        for (int num = 9;num>=1;num--){
            System.out.println(num+"*9="+num*9);
        }
         */
        /*1. 接收用户输入的一个整数num，判断它的正负零值，正数则输出"+"，负数则输出"-"，0则输出"0"
        Scanner scan = new Scanner(System.in);
        System.out.println("请输入一个整数：");
        int num = scan.nextInt();
        if(num>0){
            System.out.println("+");
        }else if(num<0){
            System.out.println("-");
        }else {
            System.out.println("0");
        }
         */
        /*2. 接收用户输入的年份year和月份month，计算该年该月的天数，并输出
        Scanner scan = new Scanner(System.in);
        System.out.println("请输入年份：");
        int year= scan.nextInt();
        System.out.println("请输入月份：");
        int month = scan.nextInt();
        int days = 0;
        switch (month){
            case 1:
            case 3:
            case 5:
            case 7:
            case 8:
            case 10:
            case 12:
                days = 31;
                break;
            case 4:
            case 6:
            case 9:
            case 11:
                days = 30;
                break;
            case 2:
                if(year%400==0||year%4==0&&year%100!=0){
                    days = 29;
                }else {
                    days = 28;
                }
        }
                System.out.println(year+"年的"+month+"月"+"共"+days+"天");
        */
        /*3. 利用循环语句while计算数字1到100的和，并输出
        int sum = 0;
        int i =1;
        while(i<=100){
            sum+=i;i++;
        }
        System.out.println("sum="+sum);
         */
        //4. 输出1900到2023年之间所有的闰年(每够10个年份，换一行)
        int count =0;
        for(int year = 1990;year<=2023;year++){
            if(year%400==0||year%4==0&&year%100!=0){
                System.out.print(year+" ");
                count++;
                if(count%10==10){
                    System.out.println("");
                }
            }
        }
    }
}
